﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace PROSHOP
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
    public class Service1 : IProshopService
    {

        #region Tung DAL

        // binh luan
        public bool themBinhLuan(int maSP, int maKH, string noiDung, DateTime ngayBL)
        {
            DAL.BinhLuanDAL binhLuan = new DAL.BinhLuanDAL();
            return binhLuan.themBinhLuan(maSP, maKH, noiDung, ngayBL);

        }

        public DataSet danhSachBinhLuan()
        {
            DAL.BinhLuanDAL bl = new DAL.BinhLuanDAL();
            return bl.danhSachBinhLuan();
        }

        public bool suaBinhLuan(int maBL, String noiDung)
        {
            DAL.BinhLuanDAL bl = new DAL.BinhLuanDAL();
            return bl.suaBinhLuan(maBL, noiDung);
        }

        //san pham
        public DataSet dsSanPham(int chungloai, int loaihang, string namelike, int nsx, string sapxep, decimal minprice, decimal maxprice)
        {
            DAL.SanPhamDAL sanpham = new DAL.SanPhamDAL();
            return sanpham.dsSanPham(chungloai, loaihang, namelike, nsx, sapxep, minprice, maxprice);
        }

        public DataSet ctSanPham(int masp)
        {
            DAL.SanPhamDAL sanpham = new DAL.SanPhamDAL();
            return sanpham.ctSanPham(masp);
        }

        // loai hang
        public DataSet dsLoaiHang(int maCL)
        {
            DAL.LoaiHangDAL loaihang = new DAL.LoaiHangDAL();
            return loaihang.dsLoaiHang(maCL);
        }

        public DataSet ctLoaiHang(int lh)
        {
            DAL.LoaiHangDAL loaihang = new DAL.LoaiHangDAL();
            return loaihang.ctLoaiHang(lh);
        }

        //giao hang
        public DataSet dsHinhThucGH()
        {
            DAL.HinhThucGHDAL gh = new DAL.HinhThucGHDAL();
            return gh.dsHinhThucGH();
        }

        //giao dich
        public DataSet dsHinhThucTT()
        {
            DAL.HinhThucTTDAL tt = new DAL.HinhThucTTDAL();
            return tt.dsHinhthucTT();
        }

        //Khach Hang
        public bool themKH(string tendn, string pw, string hoten, bool gioitinh, string email, string diachi, string dienthoai, string cauhoi, string traloi, bool status)
        {
            DAL.KhachHangDAL kh = new DAL.KhachHangDAL();
            return kh.themKH(tendn, pw, hoten, gioitinh, email, diachi, dienthoai, cauhoi, traloi, status);
        }

        public bool updateThongTinKH(int makh, string pw, string hoten, bool gioitinh, string email, string diachi, string dienthoai, string cauhoi, string traloi, bool status)
        {
            DAL.KhachHangDAL kh = new DAL.KhachHangDAL();
            return kh.updateThongTinKH(makh, pw, hoten, gioitinh, email, diachi, dienthoai, cauhoi, traloi, status);
        }

        public DataSet getThongTinKH(int makh)
        {
            DAL.KhachHangDAL kh = new DAL.KhachHangDAL();
            return kh.getThongTinKH(makh);
        }

        // Chung loai
        public DataSet ctChungLoai(int maCL)
        {
            DAL.ChungLoaiDAL cl = new DAL.ChungLoaiDAL();
            return cl.ctChungLoai(maCL);
        }

        //chi tiet don dat hang
        public DataSet dsDDH(int makh)
        {
            DAL.CTDDHDAL ct = new DAL.CTDDHDAL();
            return ct.dsDDH(makh);
        }
        #endregion

        
    }
}
